package org.rc.dto;

import lombok.Data;
import org.rc.entity.Menu;

import java.util.ArrayList;
import java.util.List;

@Data
public class MenuSelectedDto {

    private Integer id;

    private String name;

    private String pinYin;

    private String uri;

    private Integer pId;

    private Integer weight;

    private boolean selected;

    private List<MenuSelectedDto> children = new ArrayList<>();

    public static MenuSelectedDto getInstance(Menu menu){
        MenuSelectedDto menuSelectedDto = new MenuSelectedDto();
        menuSelectedDto.setId(menu.getId());
        menuSelectedDto.setName(menu.getName());
        menuSelectedDto.setPinYin(menu.getPinYin());
        menuSelectedDto.setUri(menu.getUri());
        menuSelectedDto.setPId(menu.getPId());
        menuSelectedDto.setWeight(menu.getWeight());
        return menuSelectedDto;
    }
}
